package com.nightsoul.dubbo.provider.service.impl;

import java.util.concurrent.atomic.AtomicInteger;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.rpc.RpcException;
import com.nightsoul.dubbo.provider.service.CacheService;

@Service
public class CacheServiceImpl implements CacheService {
	private final AtomicInteger i = new AtomicInteger();

    public String findCache(String id) {
    	if("mock".endsWith(id)) {
    		throw new RpcException("throw rpc exception manually");
    	}
        return "request: " + id + ", response: " + i.getAndIncrement();
    }
}
